
local total = achievements.GetValue( "That's Not A Toilet...", "total", 0 )
local function Killed( victim, inflictor )
	local ply = LocalPlayer()
	if ( !ValidEntity( ply ) ) then return end
	
	if ( total != 50 && inflictor == "prop_physics" && victim == ply ) then
		total = math.Clamp( total + 1, 0, 50 )
		achievements.Update( "That's Not A Toilet...", total / 50, total .. "/50" )
		achievements.SetValue( "That's Not A Toilet...", "total", total )
	end
end

local function PlayerKilled( msg )
	local victim, inflictor, attacker = msg:ReadEntity(), msg:ReadString(), msg:ReadString()
	Killed( victim, inflictor )
	return victim, inflictor, attacker
end
usermessage.AddHook( "PlayerKilled", "Achievements.ThatsNotAToilet", PlayerKilled )
local function PlayerKilledByPlayer( msg )
	local victim, inflictor, attacker = msg:ReadEntity(), msg:ReadString(), msg:ReadEntity()
	Killed( victim, inflictor )
	return victim, inflictor, attacker
end
usermessage.AddHook( "PlayerKilledByPlayer", "Achievements.ThatsNotAToilet", PlayerKilledByPlayer )

achievements.Register( "That's Not A Toilet...", "Die by props 50 times.", "achievements/thatsnotatoilet", total / 50, total .. "/50" )